import { Field, ObjectType } from '@nestjs/graphql';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { CommonSchema } from 'src/common/mongodb/commonSchema';
import { User } from 'src/system/user/entities/user.entity';

@ObjectType({ description: '后台活动数据' })
@Schema({ collection: 'ActivityData' })
export class Activity extends CommonSchema {
  @Field(() => String)
  @Prop()
  name: string;

  @Field(() => [User], { description: '用户列表' })
  @Prop({ type: [{ type: String, ref: 'User' }] })
  users: number[];
}
export type ActivityDocument = Activity & Document;
export const ActivitySchema = SchemaFactory.createForClass(Activity);
